using System;
using System.Collections;
using System.Collections.Generic;
using System.Text;

using Acms.SqlDal;

namespace Acms.Bll
{
    public class UserPostVoteTotal : BaseItem
    {
        protected UserPostVoteTotal() : base() { }
        protected UserPostVoteTotal(Hashtable table) : base(table) { }
        protected UserPostVoteTotal(Hashtable table, List<UserPostVoteTotal> collection) : base(table, collection) { }

        public static UserPostVoteTotal CreateInstance()
        {
            return new UserPostVoteTotal();
        }

        private static UserPostVoteTotal Get(Hashtable table)
        {
            if (table != null)
            {
                return new UserPostVoteTotal(table);
            }
            else
            {
                return null;
            }
        }

        private static List<UserPostVoteTotal> Get(Hashtable[] tables)
        {
            if (tables != null)
            {
                List<UserPostVoteTotal> tmp = new List<UserPostVoteTotal>();
                foreach (Hashtable table in tables)
                {
                    tmp.Add(new UserPostVoteTotal(table, tmp));
                }
                return tmp;
            }
            else
            {
                return null;
            }
        }

        public static List<UserPostVoteTotal> GetAllByPostId(int postId)
        {
            UserPostVoteTotalDal dal = new UserPostVoteTotalDal();
            return Get(dal.GetAllByPostId(postId));
        }

        protected override void Load(Hashtable table)
        {
            postId = (int)table[UserPostVoteTotalDal.Fields.PostId];
            score = (decimal)table[UserPostVoteTotalDal.Fields.Score];
            total = (int)table[UserPostVoteTotalDal.Fields.Total];
        }

        private int postId;
    	public int PostId
	    {
	        get { return postId;}
	    }

        private decimal score;
        public decimal Score
        {
            get { return score; }
        }

        private int total;
        public int Total
        {
            get { return total; }
        }
	
	

        protected override Acms.SqlDal.Base CreateDal()
        {
            return new UserPostVoteTotalDal();
        }
    }
}
